package com.zcxy.fast.config;

import cn.hutool.core.collection.CollectionUtil;

import com.zcxy.fast.mybatisExtend.mapper.AutoMapper;
import com.zcxy.fast.utils.SpringContextHolder;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Component
@Order(value = 1)
public class AutoMapperScan implements ApplicationRunner {
    @Override
    public void run(ApplicationArguments args) throws Exception {
        AutoMapper autoMapper = SpringContextHolder.getBean(AutoMapper.class);
        if (CollectionUtil.isEmpty(autoMapper.getR1())) {
            autoMapper.initData(autoMapper.getI1());
        }
    }
}
